Implicit cursors

Implicit cursors in PL/SQL

In PL/SQL, an implicit cursor is a cursor that is automatically created and managed by the system when a SELECT, UPDATE, DELETE, or INSERT statement is executed. The name of the cursor is not explicitly defined and the attributes of the cursor, such as its status and fetch direction, are managed automatically by the system.

When a SELECT statement is executed, the implicit cursor retrieves the result set into a set of variables or records. These variables or records are defined in the code block where the SELECT statement is executed.

Here is an example of using an implicit cursor in PL/SQL:

DECLARE
   emp_name VARCHAR2(50);
   emp_salary NUMBER(10,2);
BEGIN
   SELECT first_name, salary INTO emp_name, emp_salary FROM employees WHERE employee_id = 100;
   DBMS_OUTPUT.PUT_LINE('Employee name: ' || emp_name);
   DBMS_OUTPUT.PUT_LINE('Employee salary: ' || emp_salary);
END;

Apply for PL/SQL Certification

https://www.vskills.in/certification/certified-pl-sql-developer

Back to Tutorials

Declaration and defining
Cursor variables, using PL/SQL functions, record updates and shortcuts

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?